<template>
    <div class=''>
        <swipe></swipe>
        <h2>热门商品</h2>
        <ul class="uu">
            <li v-for="item in list" :key="item.product_id">
                <img :src="item.product_picture" alt="">
                {{item.product_name}}
                <p :style="{color:'red'}">￥{{item.product_price}}元</p>
                <span>{{item.product_intro}}</span>
            </li>
            <button @click="jx" class="jx">继续购物</button>
        </ul>
    </div>
</template>

<script>
import swipe from "../../components/swipe"
export default {
    data() {
        return {
            list:[],
        };
    },
    components:{
        swipe,
    },
    mounted() {
        this.$axios.post("/product/getHotProduct",{
            categoryName: ["电视机", "空调", "洗衣机", "保护套"],
        }).then((res)=>{
            console.log(res)
            this.list = res.data.Product
        })
    },
    methods: {
        jx(){
            this.$router.push({path:"/list"})
        }
    },
};
</script>

<style lang='scss'>
.uu{
    width: 100%;
    margin-bottom: 50px;
    display: flex;
    flex-wrap: wrap;
    li{
        width: 48%;
        margin: 3px;
        display: flex;
        flex-direction: column;
        // justify-content: center;
        align-items: center;
        border: 1px solid #ccc;
        box-sizing: border-box;
        img{
            width: 80%;
        }
    }
    .jx{
        margin-left: 50px;
        border: 0;
        background: none;
    }
}

</style>
